//
//  NibLoadable.swift
//  XIB加载（POP）
//
//  Created by 我演示 on 2019/11/5.
//  Copyright © 2019 ALLSall. All rights reserved.
//

import UIKit

protocol NibLoadable  {
    
}

extension NibLoadable where Self : UIView{
    static func loadFromNib(_ nibname : String? = nil ) -> Self {
        
        let loadName = nibname == nil ? "\(self)" : nibname
        return Bundle.main.loadNibNamed( loadName! , owner: nil, options: nil)?.first as! Self
        
    }
    
}
